<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>node节点增删改</title>
  <style>
    .box {
      width: 300px;
      height: 300px;
      border: 1px solid orange;
    }
    .inner {
      width: 100px;
      height: 100px;
      border: 1px solid blue;
    }
  </style>
  <script>
    window.onload = function() {
      // 1.获取被操作的dom节点
      var dom1 = document.getElementsByClassName('box')[0]
      // 2.创建新的dom节点
      var newDom = document.createElement('p')
      // 3.给新增dom节点添加内部内容
      newDom.innerHTML = `
        <div class="inner">
          我是新增盒子
        </div>          
      `
      // 4.将新生成的dom节点追加到dom1后
      dom1.appendChild(newDom);
      console.log(dom1);

    }
  </script>
</head>
<body>
  <div class="box">
    <div class="inner">one</div>
    <div class="inner">two</div>
    <div class="inner">three</div>
  </div>
  
</body>
</html>